package main

import (
	"fmt"
	"go.manyji.com/lib/encoding/json"
	"strconv"
)

func main() {
	kv := make([]map[string]interface{}, 0)
	err := json.Unmarshal([]byte(phoneNumber), &kv)
	if err != nil {
		fmt.Println(err)
		return
	}

	var sqls []string
	for _, v := range kv {
		vv := v

		var pl int
		if vvv, ok := v["phoneLength"]; ok {
			if s, ok := vvv.([]interface{}); ok {
				pl, _ = strconv.Atoi(fmt.Sprintf("%v", s[0].(interface{})))
			} else {
				pl = int(vvv.(float64))
			}
		}
		sqls = append(sqls, fmt.Sprintf("update country set number_bit_count = %v where short_name = '%v';\n", pl, vv["code"]))
	}
	fmt.Println(sqls)
}
